package com.yesorno.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yesorno.constants.Constants;
import com.yesorno.ui.CustomTitleActivity;

public class WaitActiveActivity extends CustomTitleActivity {

	private Button goBack;
	private Button reActive;

	private TextView textView;

	RegBtnsClickListeners rbc = new RegBtnsClickListeners();

	/**
	 * 注册页面按钮的监听类
	 * 
	 * @author samoin
	 * @date 2011-07-06
	 * @version 0.1
	 * 
	 */
	class RegBtnsClickListeners implements OnClickListener {
		@Override
		public void onClick(View v) {
			if (v == goBack) {
				Intent intent = new Intent();
				intent.putExtra("test", "waitActive");
				WaitActiveActivity.this.setResult(RESULT_OK, intent);
				WaitActiveActivity.this.finish();
			}
			if (v == reActive) {
				reActive.setText(R.string.wait_active_btn2);
				reActive.setEnabled(false);
				reActive.setTextColor(getResources().getColor(
						R.color.btn_disabled_color));
				textView.setVisibility(View.VISIBLE);
			}
		}

	}

	@Override
	public void setTitleViews() {
		LinearLayout titleLayout = getTITLE_LAYOUT();
		goBack = CustomTitleActivity.createTitleLeftButton(
				WaitActiveActivity.this, R.string.reg_title_btn_goback,
				Constants.TITLE_BTN_MARGIN1);
		goBack.setOnClickListener(rbc);
		titleLayout.addView((View) goBack.getParent());
		TextView tv = CustomTitleActivity.createTitleDesc(
				WaitActiveActivity.this, R.string.wait_active_title_common, 0);
		titleLayout.addView((View) tv.getParent());
		titleLayout.addView((View) CustomTitleActivity.createTitleDesc(
				WaitActiveActivity.this, 0, 0).getParent());

		reActive = (Button) findViewById(R.id.wait_active_btn);
		reActive.setOnClickListener(rbc);
		reActive.getPaint().setFakeBoldText(true);

		textView = (TextView) findViewById(R.id.wait_active_alert);
	}

	@Override
	public void setLayoutId() {
		setContentView(R.layout.wait_active);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

}
